package com.accp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.accp.common.DataResult;
import com.accp.service.GradeService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/grade")
@Api(tags = "年级接口")
public class GradeController {

	@Autowired
	GradeService gradeService;
	
	@ApiOperation("查询单个年级")
	@GetMapping("/fetch")
	@ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "年级id",required=true)
	})
	public DataResult fetchGrade(int id){
		return DataResult.getSuccessResult(this.gradeService.fetchGrade(id));
	}
	
	@ApiOperation("查询全部年级")
	@GetMapping("/all")
	public DataResult getAllGrade(){
		return DataResult.getSuccessResult(this.gradeService.getAllGrade());
	}
}